#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 200100;
const int MOD = 998244353;

struct Edge {
    int to, next;
} e[N << 1];

int n, m, head[N], vis[N], idx = 1;

int vert, edge; // 表示点数和边数

void add_edge(int u, int v) {
    e[idx].to = v;
    e[idx].next = head[u];
    head[u] = idx++;
}
void clear_graph() {
    memset(head, -1, sizeof(head));
    memset(e, 0, sizeof(e));
    idx = 1;
}

void dfs(int u) {
	vis[u] = true;
	vert++;
	for (int i = head[u]; ~i; i = e[i].next) {
		edge++;
		int j = e[i].to;
		if (!vis[j]) dfs(j);
	}
}
int main() {
    cin >> n >> m;
	int u, v;
	clear_graph();
    for (int i = 1; i <= m; i++) {
        cin >>u>>v;
		add_edge(u, v), add_edge(v, u);
    }
    
	ll res = 1;
    for (int i = 1; i <= n ; i++) {
        if (!vis[i]) {
			vert = edge = 0;
			dfs(i);
			if (vert*2 == edge) res = res * 2 % MOD;
			else res = 0;
		}
    }

    cout << res << endl;
    return 0;
}

